import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

export const constantRoutes = [{
  path: '/login',
  component: () => import('@/views/login/index'),
  hidden: true
},

{
  path: '/404',
  component: () => import('@/views/404'),
  hidden: true
},

{
  path: '/',
  component: Layout,
  redirect: '/home',
  children: [{
    path: 'home',
    name: 'Home',
    component: () => import('@/views/home/index'),
    meta: {
      title: '首页',
      icon: 'el-icon-s-home',
      affix: true
    }
  }]
},
]
/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [

  {
    path: '/lawsRegulationsBank',
    component: Layout,
    redirect: '/lawsRegulationsBank/lawsRegulations',
    name: 'LawsRegulationsBank',
    meta: {
      title: '法规标准库',
      icon: 'el-icon-s-order',
      permissions: ['law_standard']
    },
    children: [{
      path: 'standardBank',
      component: () => import('@/views/lawsRegulationsBank/standardBank'), // Parent router-view
      name: 'StandardBank',
      meta: {
        title: '标准库管理',
        permissions: ['law_standard:standard_lib']
      },
    },
    {
      path: 'lawsRegulations',
      name: 'LawsRegulations',
      component: () => import('@/views/lawsRegulationsBank/lawsRegulations'),
      meta: {
        title: '法律法规管理',
        permissions: ['law_standard:law_regulation'],
      },

    }
    ]
  }, {
    path: '/packageAudit',
    component: Layout,
    redirect: '/packageAudit/forbiddenMan',
    name: 'PackageAudit',
    meta: {
      title: '包装审核',
      icon: 'el-icon-s-check',
      permissions: ['packageReview']

    },
    children: [{
      path: 'forbiddenMan',
      component: () => import('@/views/packageAudit/forbiddenMan'), // Parent router-view
      name: 'ForbiddenMan',
      meta: {
        title: '禁用语管理',
        permissions: ['packageReview:sensitiveWord:list']
      },
    },
    {
      path: 'effectMan',
      name: 'EffectMan',
      component: () => import('@/views/packageAudit/effectMan'),
      meta: {
        title: '功效词汇管理',
        permissions: ['packageReview:efficacyWord:list'],
      },

    }
    ]
  },
  {
    path: '/RawManagement',
    component: Layout,
    name: 'RawManagement',
    meta: {
      title: '原料管理',
      icon: 'el-icon-menu',
      permissions: ['ingredient']
    },
    children: [{
      path: '',
      component: () => import('@/views/rawManagement/rawManagement'),
      name: 'RawManagement',
      meta: {
        title: '原料管理',
        permissions: ['ingredient:self:list']
      },
    },
    {
      path: 'rawDetai',
      component: () => import('@/views/rawManagement/rawDetai'),
      name: 'RawDetai',
      meta: {
        title: '原料详情',
        permissions: ['ingredient:self:info']
      },
      hidden: true
    }
    ]
  }, {
    path: '/dataAnalysis',
    component: Layout,
    name: 'dataAnalysis',
    meta: {
      title: '数据分析',
      icon: 'el-icon-menu',
      permissions: ['ingredient']
    },
    children: [{
      path: '',
      component: () => import('@/views/dataAnalysis/index'),
      name: 'index',
      meta: {
        title: '数据分析',
        permissions: ['ingredient:self:list']
      },
    },

    ]
  }, {
    path: '/EfficacyScheme',
    component: Layout,
    redirect: '/efficacyScheme/efficacyList',
    name: 'EfficacyScheme',
    meta: {
      title: '功效方案',
      icon: 'el-icon-s-management',
      permissions: ['efficacy']
    },

    children: [{
      path: 'efficacyList',
      component: () => import('@/views/efficacyScheme/efficacyList'), // Parent router-view
      name: 'EfficacyList',
      meta: {
        title: '功效方案管理',
        permissions: ['efficacy:plan:list']
      },
    },
    {
      path: 'userEfficacy',
      component: () => import('@/views/efficacyScheme/userEfficacy'), // Parent router-view
      name: 'UserEfficacy',
      meta: {
        title: '用户功效方案申请',
        permissions: ['efficacy:user:plan:list']
      },
    }
    ],



  }, {
    path: '/operationManagement',
    component: Layout,
    redirect: '/operationManagement/industryNews',
    name: 'OperationManagement',
    meta: {
      title: '运营管理',
      icon: 'el-icon-s-opportunity',
      permissions: ['operation']
    },
    children: [{
      path: 'industryNews',
      component: () => import('@/views/operationManagement/industryNews'), // Parent router-view
      name: 'IndustryNews',
      meta: {
        title: '行业资讯',
        permissions: ['operation:news:list']
      },
    },
    {
      path: 'industayView',
      component: () => import('@/views/operationManagement/industayView'),
      name: 'IndustayView',
      meta: {
        title: '行业资讯',
        permissions: ['operation:news:info']
      },
      hidden: true
    },
    {
      path: 'bannerSet',
      name: 'BannerSet',
      component: () => import('@/views/operationManagement/bannerSet'),
      meta: {
        title: 'banner管理',
        permissions: ['operation:banner:list']
      }
    },
    {
      path: 'hotSearch',
      name: 'HotSearch',
      component: () => import('@/views/operationManagement/hotSearch'),
      meta: {
        title: '热搜词',
        permissions: ['operation:hot_search:list']
      }
    }
    ]
  }, {
    path: '/apManagement',
    component: Layout,
    redirect: '/apManagement/exposedInformation',
    name: 'ApManagement',
    meta: {
      title: '安评管理',
      icon: 'el-icon-s-claim',
      permissions: ['sale']
    },

    children: [{
      path: 'exposedInformation',
      component: () => import('@/views/apManagement/exposedInformation'), // Parent router-view
      name: 'ExposedInformation',
      meta: {
        title: '暴露信息管理',
        permissions: ['sale:exposeInfo:list']
      },
    },
    {
      path: 'reportManagement',
      component: () => import('@/views/apManagement/reportManagement'), // Parent router-view
      name: 'ReportManagement',
      meta: {
        title: '安评报告管理',
        permissions: ['sale:record']
      },
    },
    {
      path: 'changeAssess',
      component: () => import('@/views/apManagement/changeAssess'), // Parent router-view
      name: 'ChangeAssess',
      meta: {
        title: '查看评估人',
        permissions: ['sale:evaluator']
      },
    }
    ],



  }, {
    path: '/communityManagement',
    component: Layout,
    redirect: '/communityManagement/audit',
    name: 'CommunityManagement',
    meta: {
      title: '社区管理',
      icon: 'el-icon-s-comment',
      permissions: ['community1']

    },

    children: [{
      path: 'audit',
      component: () => import('@/views/communityManagement/audit'), // Parent router-view
      name: 'Audit',
      meta: {
        title: '动态审核',
        permissions: ['community:poster:list']
      },
    }, {
      path: 'commentsList',
      component: () => import('@/views/communityManagement/comment/commentsList'), // Parent router-view
      name: 'CommentsList',
      meta: {
        title: '评论管理',
        permissions: ['community:comment:list']
      },
    }, {
      path: 'changeComment',
      component: () => import('@/views/communityManagement/comment/changeComment'), // Parent router-view
      name: 'ChangeComment',
      meta: {
        title: '查看评论',
        permissions: ['community:comment:list']
      },
      hidden: true,
    },
    {
      path: 'sensitiveWord',
      component: () => import('@/views/communityManagement/sensitiveWord'), // Parent router-view
      name: 'SensitiveWord',
      meta: {
        title: '敏感词管理',
        permissions: ['community:sensitive:list']
      },
    },
    {
      path: 'topic',
      component: () => import('@/views/communityManagement/topic'), // Parent router-view
      name: 'Topic',
      meta: {
        title: '话题管理',
        permissions: ['community:topic:list']
      },
    },
    {
      path: 'communityUser',
      component: () => import('@/views/communityManagement/communityUser'), // Parent router-view
      name: 'CommunityUser',
      meta: {
        title: '社区用户',
        permissions: ['community:posterUser:list']
      },
    }
    ],



  },
  // {
  //   path: '/goodsClass',
  //   component: Layout,
  //   redirect: '/goodsClass',
  //   name: 'goodsClass',
  //   meta: {
  //     title: '商品分类',
  //     icon: 'el-icon-notebook-2',
  //     permissions: ['productCategory']
  //   },

  //   children: [{
  //     path: 'goodsClass',
  //     name: 'goodsClass',
  //     component: () => import('@/views/goodsClass/index'),
  //     meta: {
  //       title: '商品分类',
  //       permissions: ['productCategory:page'],
  //     }
  //   },
  //   ],
  // },
  {
    path: '/pointsGoods',
    component: Layout,
    redirect: '/pointsGoods',
    name: 'pointsGoods',
    meta: {
      title: '积分商品',
      icon: 'el-icon-s-management',
      permissions: ['creditProduct']
    },

    children: [{
      path: 'pointsGoods',
      name: 'pointsGoods',
      component: () => import('@/views/pointsGoods/index'),
      meta: {
        title: '积分商品',
        permissions: ['creditProduct:page'],
      }
    },
    ],
  },
  {
    path: '/couponList',
    component: Layout,
    redirect: '/couponList',
    name: 'couponList',
    meta: {
      title: '优惠券列表',
      icon: 'el-icon-s-management',
      permissions: ['coupon']
    },

    children: [{
      path: 'couponList',
      name: 'couponList',
      component: () => import('@/views/couponClass/couponList'),
      meta: {
        title: '优惠券列表',
        permissions: ['coupon:page'],
      }
    },
    ],
  },
  // {
  //   path: '/writeOff',
  //   component: Layout,
  //   redirect: '/writeOff/writeOff',
  //   name: 'writeOff',
  //   meta: {
  //     title: '核销',
  //     icon: 'el-icon-s-management',
  //     permissions: ['venue']
  //   },

  //   children: [{
  //     path: 'writeOff',
  //     name: 'writeOff',
  //     component: () => import('@/views/writeOff/writeOff'),
  //     meta: {
  //       title: '核销',
  //       permissions: ['writeOff:page'],
  //     }
  //   },
  //   ],
  // },
  {
    path: '/orderManagement',
    component: Layout,
    redirect: '/orderManagement/orderManagement',
    name: 'orderManagement',
    meta: {
      title: '订单管理',
      icon: 'el-icon-notebook-2',
      permissions: ['orderMenu']
    },

    children: [{
      path: 'orderManagement',
      name: 'OrderManagement',
      component: () => import('@/views/orderManagement/orderManagement'),
      meta: {
        title: '订单管理',
        permissions: ['orderMenu:order'],
      }
    },
    ],



  },
  {
    path: '/financeManagement',
    component: Layout,
    redirect: '/financeManagement/paymentManagement',
    name: 'paymentManagement',
    meta: {
      title: '财务管理',
      icon: 'el-icon-coin',
      permissions: ['financeMenu']
    },

    children: [{
      path: 'paymentManagement',
      name: 'PaymentManagement',
      component: () => import('@/views/financeManagement/paymentManagement'),
      meta: {
        title: '支付流水',
        permissions: ['financeMenu:pay'],
      }
    },
    ],



  }, {
    path: '/merchantView',
    component: Layout,
    redirect: '/merchantView/merchantViewList',
    name: 'merchantView',
    meta: {
      title: '商户意见反馈管理',
      icon: 'el-icon-notebook-2',
      permissions: ['feedback']
    }, children: [{
      path: 'merchantView',
      component: () => import('@/views/merchantView/merchantViewList'), // Parent router-view
      name: 'merchantList',
      meta: {
        title: '商户意见反馈管理',
        permissions: ['feedback:page']
      },
    }]
  },
  {
    path: '/creditOrder',
    component: Layout,
    redirect: '/creditOrder/creditOrderList',
    name: 'creditOrder',
    meta: {
      title: '积分订单管理',
      icon: 'el-icon-notebook-2',
      permissions: ['creditOrder']
    }, children: [{
      path: 'creditOrder',
      component: () => import('@/views/creditOrder/creditOrderList'), // Parent router-view
      name: 'creditOrder',
      meta: {
        title: '积分订单列表',
        permissions: ['creditOrder:page']
      },
    }]
  },
  {
    path: '/merchantReport',
    component: Layout,
    redirect: '/merchantReport/merchantReport',
    name: 'merchantReport',
    meta: {
      title: '商户报表',
      icon: 'el-icon-notebook-2',
      permissions: ['merchantReport']
    }, children: [{
      path: 'merchantReport',
      component: () => import('@/views/merchantReport/merchantReport'), // Parent router-view
      name: 'merchantReport',
      meta: {
        title: '商户报表',
        permissions: ['merchantReport:page']
      },
    }]
  }
  // , {
  //   path: '/mallArea',
  //   component: Layout,
  //   redirect: '/mallArea/mallArea',
  //   name: 'mallArea',
  //   meta: {
  //     title: '区域管理',
  //     icon: 'el-icon-s-comment',
  //     permissions: ['mallArea']
  //   }, children: [{
  //     path: 'mallArea',
  //     component: () => import('@/views/mallArea/mallArea'), // Parent router-view
  //     name: 'mallArea',
  //     meta: {
  //       title: '区域管理',
  //       permissions: ['mallArea:page']
  //     },
  //   }]
  // }
  // , {
  //   path: '/floor',
  //   component: Layout,
  //   redirect: '/floor/floor',
  //   name: 'floor',
  //   meta: {
  //     title: '楼层管理',
  //     icon: 'el-icon-s-comment',
  //     permissions: ['floor']
  //   }, children: [ {
  //     path: 'mallArea',
  //     component: () => import('@/views/mallArea/mallArea'), // Parent router-view
  //     name: 'mallArea',
  //     meta: {
  //       title: '区域管理',
  //       permissions: ['mallArea:page']
  //     },
  //   },{
  //     path: 'floor',
  //     component: () => import('@/views/mallArea/floor'), // Parent router-view
  //     name: 'floor',
  //     meta: {
  //       title: '楼层管理',
  //       permissions: ['floor:page']
  //     },
  //   }]
  // }
  , {
    path: '/shopCategory',
    component: Layout,
    redirect: '/shopCategory/shopCategory',
    name: 'shopCategory',
    meta: {
      title: '品牌商铺分类',
      icon: 'el-icon-s-comment',
      permissions: ['shopCategory']
    }, children: [{
      path: 'shopCategory',
      component: () => import('@/views/mallArea/shopClass'), // Parent router-view
      name: 'shopCategory',
      meta: {
        title: '品牌商铺分类',
        permissions: ['shopCategory:page']
      },
    }]
  },
  // {
  //   path: '/shop',
  //   component: Layout,
  //   redirect: '/shop/shop',
  //   name: 'shop',
  //   meta: {
  //     title: '品牌商铺',
  //     icon: 'el-icon-s-comment',
  //     permissions: ['shop']
  //   }, children: [{
  //     path: 'shop',
  //     component: () => import('@/views/mallArea/shop'), // Parent router-view
  //     name: 'shop',
  //     meta: {
  //       title: '品牌商铺',
  //       permissions: ['shop:page']
  //     },
  //   }]
  // }, 
  {
    path: '/employeeCard',
    component: Layout,
    redirect: '/employeeCard/employeeCard',
    name: 'employeeCard',
    meta: {
      title: '员工卡',
      icon: 'el-icon-s-comment',
      permissions: ['employeeCard']
    }, children: [{
      path: 'employeeCard',
      component: () => import('@/views/employeeCard/employeeCard'), // Parent router-view
      name: 'employeeCard',
      meta: {
        title: '员工卡',
        permissions: ['employeeCard:page']
      },
    }]
  },
  {
    path: '/userList',
    component: Layout,
    redirect: '/userList/userList',
    name: 'userList',
    meta: {
      title: '用户管理',
      icon: 'el-icon-user',
      permissions: ['user']
    }, children: [
      {
        path: 'userList/userList',
        name: 'userList',
        component: () => import('@/views/userList/index'),
        meta: {
          title: '用户管理',
          permissions: ['user'],
        }
      },]
  },
  {
    path: '/merchantManagement',
    component: Layout,
    redirect: '/merchantManagement/goodsClass',
    name: 'userList',
    meta: {
      title: '商品管理',
      icon: 'el-icon-s-shop',
      permissions: ['merchant']
    }, children: [
      {
        path: 'goodsClass',
        name: 'goodsClass',
        component: () => import('@/views/goodsClass/index'),
        meta: {
          title: '商品分类',
          permissions: ['merchant:productCategory'],
        }
      }, {
        path: 'pointsGoods',
        name: 'pointsGoods',
        component: () => import('@/views/pointsGoods/index'),
        meta: {
          title: '积分商品',
          permissions: ['merchant:creditProduct'],
        }
      }, {
        path: 'creditOrder',
        component: () => import('@/views/creditOrder/creditOrderList'), // Parent router-view
        name: 'creditOrder',
        meta: {
          title: '积分订单列表',
          permissions: ['merchant:creditOrder']
        },
      }
    ]
  },
  {
    path: '/storeManagement',
    component: Layout,
    redirect: '/storeManagement/shopCategory',
    name: 'userList',
    meta: {
      title: '门店管理',
      icon: 'el-icon-notebook-2',
      permissions: ['shop']
    }, children: [
      {
        path: 'shopCategory',
        component: () => import('@/views/mallArea/shopClass'), // Parent router-view
        name: 'shopCategory',
        meta: {
          title: '品牌店铺分类',
          permissions: ['shop:shopCategory']
        },
      }, {
        path: 'shop',
        component: () => import('@/views/mallArea/shop'), // Parent router-view
        name: 'shop',
        meta: {
          title: '品牌店铺',
          permissions: ['shop:brand']
        },
      },
      {
        path: 'shopfloor',
        component: () => import('@/views/mallArea/mallArea'), // Parent router-view
        name: 'shopfloor',
        meta: {
          title: '区域管理',
          permissions: ['shop:floor:mallArea']
        },
      },
      {
        path: 'floor',
        component: () => import('@/views/mallArea/floor'), // Parent router-view
        name: 'floor',
        meta: {
          title: '楼层管理',
          permissions: ['shop:floor:floor']
        },
      },
      // {
      //   path: '/shopfloor',
      //   component: '',
      //   // component: () => import('@/views/mallArea/mallArea'), // Parent router-view
      //   redirect: '/shopfloor/shopfloor',
      //   name: 'shopfloor',
      //   meta: {
      //     title: '楼层管理',
      //     icon: 'el-icon-notebook-2',
      //     permissions: ['shop:floor']
      //   }, children: [
      //     {
      //       path: 'shopfloor',
      //       component: () => import('@/views/mallArea/mallArea'), // Parent router-view
      //       name: 'shopfloor',
      //       meta: {
      //         title: '区域管理',
      //         permissions: ['shop:floor:mallArea']
      //       },
      //     },
      //     {
      //       path: 'floor',
      //       component: () => import('@/views/mallArea/floor'), // Parent router-view
      //       name: 'floor',
      //       meta: {
      //         title: '楼层管理',
      //         permissions: ['shop:floor:floor']
      //       },
      //     },]
      // }, 
      {
        path: 'couponList',
        name: 'couponList',
        component: () => import('@/views/couponClass/couponList'),
        meta: {
          title: '优惠券列表',
          permissions: ['shop:coupon'],
        }
      }, {
        path: 'writeOff',
        name: 'writeOff',
        component: () => import('@/views/writeOff/writeOff'),
        meta: {
          title: '核销',
          permissions: ['shop:writeOff'],
        }
      }, {
        path: 'merchantView',
        component: () => import('@/views/merchantView/merchantViewList'), // Parent router-view
        name: 'merchantList',
        meta: {
          title: '商户意见反馈管理',
          permissions: ['shop:feedback']
        },
      }, {
        path: 'merchantReport',
        component: () => import('@/views/merchantReport/merchantReport'), // Parent router-view
        name: 'merchantReport',
        meta: {
          title: '商户报表',
          permissions: ['shop:merchantReport']
        },
      }
    ]
  }, {
    path: '/receipt',
    component: Layout,
    redirect: '/receipt/receiptList',
    name: 'activityManagement',
    meta: {
      title: '小票',
      icon: 'el-icon-s-claim',
      permissions: ['receipt']
    }, children: [{
      path: 'receipt',
      component: () => import('@/views/receipt/receiptList'), // Parent router-view
      name: 'receipt',
      meta: {
        title: '小票',
        permissions: ['receipt:page']
      },
    }]
  },
  {
    path: '/couponClass',
    component: Layout,
    redirect: '/couponClass',
    name: 'couponClass',
    meta: {
      title: '优惠券分类',
      icon: 'el-icon-coin',
      permissions: ['couponCategory']
    },

    children: [{
      path: 'couponClass',
      name: 'couponClass',
      component: () => import('@/views/couponClass/index'),
      meta: {
        title: '优惠券分类',
        permissions: ['couponCategory:list'],
      }
    },
    ],
  }, {
    path: '/activityManagement',
    component: Layout,
    redirect: '/activityManagement/activityList',
    name: 'activityManagement',
    meta: {
      title: '活动管理',
      icon: 'el-icon-suitcase-1',
      permissions: ['activity']
    }, children: [{
      path: 'activityList',
      component: () => import('@/views/activityManagement/activityList'), // Parent router-view
      name: 'activityList',
      meta: {
        title: '活动管理',
        permissions: ['activity:page']
      },
    }]
  }, {
    path: '/activityReview',
    component: Layout,
    redirect: '/activityReview/activityReviewList',
    name: 'activityReview',
    meta: {
      title: '活动回顾',
      icon: 'el-icon-suitcase-1',
      permissions: ['activity']
    }, children: [{
      path: 'activityReviewList',
      component: () => import('@/views/activityManagement/activityReviewList'), // Parent router-view
      name: 'activityReviewList',
      meta: {
        title: '活动回顾',
        permissions: ['activityReview:page']
      },
    }]
  }, {
    path: '/communityManagement',
    component: Layout,
    redirect: '/communityManagement/merchantList',
    name: 'SystemManagement',
    meta: {
      title: '社区服务',
      icon: 'el-icon-s-unfold',
      permissions: ['community']
    }, children: [{
      path: 'community',
      component: () => import('@/views/merchantManagement/merchantList'), // Parent router-view
      name: 'community',
      meta: {
        title: '社区服务',
        permissions: ['community:page']
      },
    }]
  }, {
    path: '/siteManagement',
    component: Layout,
    redirect: '/siteManagement/siteManagement',
    name: 'siteManagement',
    meta: {
      title: '场地管理',
      icon: 'el-icon-office-building',
      permissions: ['venue']
    }, children: [{
      path: 'merchantView',
      component: () => import('@/views/siteManagement/index'), // Parent router-view
      name: 'merchantList',
      meta: {
        title: '场地管理',
        permissions: ['venue:page']
      },
    }]
  },
  //  {
  //   path: '/vehicleManagement',
  //   component: Layout,
  //   redirect: '/vehicleManagement/vehicleManagement',
  //   name: 'vehicleManagement',
  //   meta: {
  //     title: '车辆管理',
  //     icon: 'el-icon-truck',
  //     permissions: ['venue']
  //   }, children: [{
  //     path: 'merchantView',
  //     component: () => import('@/views/siteManagement/index'), // Parent router-view
  //     name: 'merchantList',
  //     meta: {
  //       title: '车辆管理-未调接口',
  //       permissions: ['venue:page']
  //     },
  //   }]
  // },
  // {
  //   path: '/repair',
  //   component: Layout,
  //   redirect: '/repair/repairList',
  //   name: 'repair',
  //   meta: {
  //     title: '报修信息管理',
  //     icon: 'el-icon-notebook-2',
  //     permissions: ['repair']
  //   }, children: [{
  //     path: 'repair',
  //     component: () => import('@/views/repair/repairList'), // Parent router-view
  //     name: 'merchantList',
  //     meta: {
  //       title: '报修信息管理',
  //       permissions: ['repair:page']
  //     },
  //   }]
  // },
  {
    path: '/userCoupon',
    component: Layout,
    redirect: '/userCoupon/userCoupon',
    name: 'userCoupon',
    meta: {
      title: '用户优惠券',
      icon: 'el-icon-set-up',
      permissions: ['venue']
    },

    children: [{
      path: 'userCoupon',
      name: 'userCoupon',
      component: () => import('@/views/couponClass/userCoupon'),
      meta: {
        title: '用户优惠券',
        permissions: ['userCoupon:page'],
      }
    },
    ],
  }, {
    path: '/banner',
    component: Layout,
    redirect: '/banner/bannerList',
    name: 'banner',
    meta: {
      title: 'banner列表',
      icon: 'el-icon-picture-outline',
      permissions: ['banner']
    }, children: [{
      path: 'bannerList',
      component: () => import('@/views/mallArea/bannerList'), // Parent router-view
      name: 'bannerList',
      meta: {
        title: 'banner列表',
        permissions: ['banner:page']
      },
    }]
  }, {
    path: '/configuration',
    component: Layout,
    redirect: '/configuration/configuration',
    name: 'configuration',
    meta: {
      title: '配置管理',
      icon: 'el-icon-setting',
      permissions: ['config']
    }, children: [{
      path: 'configuration',
      component: () => import('@/views/configuration/configuration'), // Parent router-view
      name: 'configuration',
      meta: {
        title: '配置管理',
        permissions: ['config']
      },
    }]
  }, {
    path: '/carParkOrder',
    component: Layout,
    redirect: '/carParkOrder/carParkOrderList',
    name: 'carParkOrder',
    meta: {
      title: '停车订单',
      icon: 'el-icon-truck',
      permissions: ['carParkOrder']
    }, children: [{
      path: 'carParkOrderList',
      component: () => import('@/views/carParkOrder/carParkOrderList'), // Parent router-view
      name: 'carParkOrder',
      meta: {
        title: '停车订单',
        permissions: ['carParkOrder']
      },
    }]
  },
  {
    path: '/systemManagement',
    component: Layout,
    redirect: '/systemManagement/roleManagement',
    name: 'SystemManagement',
    meta: {
      title: '系统管理',
      icon: 'el-icon-s-tools',
      permissions: ['system']
    },
    children: [{
      path: 'pricingScheme',
      component: () => import('@/views/systemManagement/pricingScheme'), // Parent router-view
      name: 'PricingScheme',
      meta: {
        title: '定价方案',
        permissions: ['system:plan']
      },
    }, {
      path: 'roleManagement',
      component: () => import('@/views/systemManagement/roleManagement'), // Parent router-view
      name: 'RoleManagement',
      meta: {
        title: '角色管理',
        permissions: ['system:role:list']
      },
    },
    {
      path: 'staffManagement',
      name: 'StaffManagement',
      component: () => import('@/views/systemManagement/staffManagement'),
      meta: {
        title: '员工管理',
        permissions: ['system:admin:list']
      }
    },
    // {
    //   path: 'userManagement',
    //   name: 'UserManagement',
    //   component: () => import('@/views/systemManagement/userManagement'),
    //   meta: {
    //     title: '用户管理',
    //     permissions: ['system:user:list'],
    //   }
    // },
    {
      path: 'userManagementDetail',
      name: 'UserManagementDetail',
      component: () => import('@/views/systemManagement/userManagementDetail'),
      meta: {
        title: '用户详情',
        permissions: ['system:user:list'],
      },
      hidden: true
    },
    {
      path: 'systemSet',
      component: () => import('@/views/systemSet/systemSet'), // Parent router-view
      name: 'systemSet',
      meta: {
        title: '系统设置',
        permissions: ['system:setting']
      }
    },
      // {
      //   path: 'dictionaryManagement',
      //   component: () => import('@/views/dictionaryManagement/dictionaryManagement'),
      //   name: 'DictionaryManagement',
      //   meta: {
      //     title: '字典管理',
      //     permissions: ['system:dict']
      //   },
      // },
      // {
      //   path: 'dictionaryDetail',
      //   component: () => import('@/views/dictionaryManagement/dictionaryDetail'),
      //   name: 'DictionaryDetail',
      //   meta: {
      //     title: '字典详情',
      //     permissions: ['system:dict']
      //   },
      //   hidden: true
      // }
    ]
  },


  // 404 page must be placed at the end !!!
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]
const createRouter = () => new Router({
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})
const router = createRouter()
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
